home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 5.2 KB | 195 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWShape.h
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWSHAPE_H
- #define FWSHAPE_H
-
- #ifndef FWGROBJ_H
- #include "FWGrObj.h"
- #endif
-
- #ifndef FWPOINT_H
- #include "FWPoint.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #ifndef FWGRDEF_H
- #include "FWGrDef.h"
- #endif
-
- #ifndef FWINK_H
- #include "FWInk.h"
- #endif
-
- #ifndef FWSTYLE_H
- #include "FWStyle.h"
- #endif
-
- #ifndef FWDFAULT_H
- #include "FWDfault.h"
- #endif
-
- //========================================================================================
- // •• Forward Declarations
- //========================================================================================
-
- class FW_CGraphicContext;
- class XMPTransform;
- class FW_CShapeRep;
-
- //========================================================================================
- // •• CLASS FW_CShape
- //========================================================================================
-
- class FW_CShape : public FW_CGraphicObjectPtr
- {
- //----------------------------------------------------------------------------------------
- // • Constructors
- //
- public:
- FW_CShape();
- FW_CShape(const FW_CShape& other);
- FW_CShape(FW_CShapeRep* rep);
-
- //----------------------------------------------------------------------------------------
- // • Operators
- //
- public:
- FW_CShape& operator=(const FW_CShape& other);
- FW_CShape& operator=(FW_CShapeRep* other);
-
- FW_CShapeRep* operator->() const
- {return (FW_CShapeRep*)GetRep();}
- };
-
- //==============================================================================
- // •• class FW_CShapeRep
- //==============================================================================
-
- class FW_CShapeRep : public FW_CGraphicObjectRep
- {
-
- //------------------------------------------------------------------------------
- // • Constructors/Destructors
- //
- public:
- virtual ~FW_CShapeRep();
-
- protected:
- FW_CShapeRep();
- FW_CShapeRep(const FW_CShapeRep& shapeRep);
- FW_CShapeRep(const FW_SDefaultProperties& defaultProperties);
-
- //------------------------------------------------------------------------------
- // • New API
- //
- public:
- // ----- Rendering -----
- virtual void Draw(FW_CGraphicContext* graphicContext) = 0;
-
- // ----- Hit Testing -----
- virtual FW_HitTestPart HitTest(const FW_CPoint& test) const = 0;
-
- // ----- Transform -----
- virtual void Transform(XMPTransform* transform) = 0;
- virtual void InverseTransform(XMPTransform* transform) = 0;
-
- virtual void MoveShape(XMPCoordinate deltaX, XMPCoordinate deltaY) = 0;
- virtual void MoveShapeTo(XMPCoordinate x, XMPCoordinate y) = 0;
-
- // ----- Geometry -----
- virtual FW_CRect GetShapeBounds() const = 0;
-
- // ----- Default shape -----
- virtual void SetAsDefault() const = 0;
-
- // ----- Getters/Setters -----
- FW_ShapeFills GetShapeFill() const
- {return fShapeFill;}
- void SetShapeFill(FW_ShapeFills shapeFill)
- {fShapeFill = shapeFill;}
-
- FW_CInk GetShapeInk() const
- {return fShapeInk;}
- void SetShapeInk(FW_CInk newInk)
- {fShapeInk = newInk;}
-
- FW_CStyle GetShapeStyle() const
- {return fShapeStyle;}
- void SetShapeStyle(FW_CStyle newStyle)
- {fShapeStyle = newStyle;}
-
- FW_HitTestPart GetHitTestPart() const
- {return fHitTestPart;}
- void SetHitTestPart(FW_HitTestPart hitTestPart)
- {fHitTestPart = hitTestPart;}
-
- XMPCoordinate GetHitTestTolerance() const
- {return fTolerance;}
- void SetHitTestTolerance(XMPCoordinate tolerance)
- {fTolerance = tolerance;}
-
- // ----- Style access -----
- XMPCoordinate GetPenSize() const
- {return fShapeStyle->GetPenSize();}
- void SetPenSize(XMPCoordinate penSize);
-
- void GetPattern(FW_CPattern& pattern) const
- {fShapeStyle->GetPattern(pattern);}
- void SetPattern(const FW_CPattern& pattern);
-
- void SetFontSize(XMPCoordinate fontSize);
- XMPCoordinate GetFontSize() const
- {return fShapeStyle->GetFontSize();}
-
- void SetFontStyle(FW_FontStyle fontStyle);
- FW_FontStyle GetFontStyle() const
- {return fShapeStyle->GetFontStyle();}
-
- void SetFontName(const FW_CDynamicString& fontName);
- void GetFontName(FW_CDynamicString& fontName) const
- {fShapeStyle->GetFontName(fontName);}
-
- // ----- Ink access -----
- void GetForeColor(FW_CColor* color) const
- {fShapeInk->GetForeColor(color);}
- void SetForeColor(const FW_CColor& color);
-
- void GetBackColor(FW_CColor* color) const
- {fShapeInk->GetBackColor(color);}
- void SetBackColor(const FW_CColor& color);
-
- FW_TransferMode GetTransferMode() const
- {return fShapeInk->GetTransferMode();}
- void SetTransferMode(FW_TransferMode transferMode);
-
- protected:
- void SetDefaultProperties(FW_SDefaultProperties& defaultProperties) const;
-
- private:
- void NewInkIfShared();
- void NewStyleIfShared();
-
- //------------------------------------------------------------------------------
- // • Data Members
- //
- private:
- FW_CInk fShapeInk;
- FW_CStyle fShapeStyle;
- FW_ShapeFills fShapeFill;
- FW_HitTestPart fHitTestPart;
- XMPCoordinate fTolerance;
- };
-
- #endif